import type { UploadImage } from '@/api/uploadImg'
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'

export const useConsultStore = defineStore(
  'consult',
  () => {
    const illnessInfo = ref({
      illnessDesc: '',
      illnessTime: 1,
      consultFlag: 0,
      pictures: [] as UploadImage[],
    })
    const patientId = ref('')
    const type = ref('')
    const illnessType = ref('')
    const depId = ref('')
    const clear = () => {
      illnessInfo.value = {
        illnessDesc: '',
        illnessTime: 1,
        consultFlag: 0,
        pictures: [],
      }
      patientId.value = ''
      type.value = ''
      illnessType.value = ''
      depId.value = ''
    }
    return { illnessInfo, type, illnessType, depId, patientId, clear }
  },
  {
    unistorage: true,
  }
)
